package com.example.blog_system.dao;

import com.example.blog_system.model.domain.Article;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Options;
import org.apache.ibatis.annotations.Select;
//import org.apache.ibatis.annotations.*;

import java.util.List;
//
@Mapper
public interface ArticleMapper {
    @Select("SELECT * FROM t_article WHERE id=#{id}")
    public Article selectArticleWithId(Integer id);
//
    @Insert("insert into t_article (title,created,modified,tags,categories,"+"allow_comment,thumbnail,content)"+"values(#{title},#{created},#{modified},#{tags},#{categories},"+"#{allowComment},#{thumbnail},#{content})")
    @Options(useGeneratedKeys = true,keyProperty = "id", keyColumn = "id")
    public Integer publishArticle(Article article);
//
    @Select("select * from t_article order by id desc")
    public List<Article> selectArticleWithPage();
//
//    @Delete("delete from t_article where id=#{id}")
//    public void deleteArticleWithId(int id);
//
//    @Select("select count(1) from t_article")
//    public Integer countArticle();
//    public Integer updateArticleWithId(Article article);
}
